package com.fosdata.dpm.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fosdata.dpm.domain.SysXbdev;
import com.fosdata.dpm.domain.XbDevRecoder;
import com.fosdata.dpm.services.mapper.XbDevRecoderMapper;
import com.fosdata.dpm.services.XbDevRecoderServices;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 箱变资料说明 服务实现类
 * </p>
 *
 * @author gyk
 * @since 2025-10-22
 */
@Service
public class XbDevRecoderServicesImpl extends ServiceImpl<XbDevRecoderMapper, XbDevRecoder> implements XbDevRecoderServices {

    @Override
    public List<XbDevRecoder> getRecordByCode(List<SysXbdev> sysXbdevs) {
        try {
            List<XbDevRecoder> list = new ArrayList<>();
            for(SysXbdev xbdev:sysXbdevs){
                LambdaQueryWrapper<XbDevRecoder> queryWrapper = new LambdaQueryWrapper<>();
                queryWrapper.eq(XbDevRecoder::getDevCode,xbdev.getXbdCode()).eq(XbDevRecoder::getDelFlag,0);
                List<XbDevRecoder> xbDevRecoder = this.baseMapper.selectList(queryWrapper);
                list.addAll(xbDevRecoder);
            }
            return list;
        }catch (Exception e){
            log.error(e.getMessage());
            return null;
        }
    }
}
